home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / ada_lrm1.zip / CHAPC.DOC < prev    next >
Text File  |  1988-11-30  |  14KB  |  530 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. The following document is a draft  of  the  corresponding  chapter  of  the
  7. version  of  the  Ada  Reference  Manual  produced  in response to the Ansi
  8. Canvass.  It is given a limited circulation  to  Ada  implementers  and  to
  9. other groups contributing comments (according to the conventions defined in
  10. RRM.comments).  This draft should not be referred to in any publication.
  11.  
  12.  
  13.  
  14.                        ANSI-RM-C-v23 - Draft Chapter
  15.                     C  Predefined Language Environment
  16.                                 version 23
  17.  
  18.  
  19.                                  83-02-11
  20.  
  21.  
  22. This version has addressed all comments up to #5795
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.                     C. Predefined Language Environment
  78.  
  79.  
  80.  
  81.  
  82. This  annex  outlines  the specification of the package STANDARD containing
  83. all predefined identifiers in the language.  The corresponding package body
  84. is implementation-defined and is not shown.
  85.  
  86. The operators that are predefined for the types  declared  in  the  package
  87. STANDARD are given in comments since they are implicitly declared.  Italics
  88. are  used for  pseudo-names of anonymous types (such as universal_real) and
  89. for   undefined   information   (such   as    implementation_defined    and
  90. any_fixed_point_type).
  91.  
  92. package STANDARD is
  93.  
  94.    type BOOLEAN is (FALSE, TRUE);
  95.  
  96.    -- The predefined relational operators for this type are as follows:
  97.  
  98.    -- function "="   (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  99.    -- function "/="  (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  100.    -- function "<"   (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  101.    -- function "<="  (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  102.    -- function ">"   (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  103.    -- function ">="  (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  104.  
  105.    -- The predefined logical operators and the predefined logical negation operator are as follows:
  106.  
  107.    -- function "and" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  108.    -- function "or"  (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  109.    -- function "xor" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
  110.  
  111.    -- function "not" (RIGHT : BOOLEAN) return BOOLEAN;
  112.  
  113.  
  114.  
  115.    -- The universal type universal_integer is predefined.
  116.  
  117.  
  118.    type INTEGER is IMPLEMENTATION_DEFINED;
  119.  
  120.    -- The predefined operators for this type are as follows:
  121.  
  122.    -- function "="  (LEFT, RIGHT : INTEGER) return BOOLEAN;
  123.    -- function "/=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
  124.    -- function "<"  (LEFT, RIGHT : INTEGER) return BOOLEAN;
  125.    -- function "<=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
  126.    -- function ">"  (LEFT, RIGHT : INTEGER) return BOOLEAN;
  127.  
  128.  
  129.                                    C - 1
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.    -- function ">=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                    C - 2
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.    -- function "+"   (RIGHT : INTEGER) return INTEGER;
  205.    -- function "-"   (RIGHT : INTEGER) return INTEGER;
  206.    -- function "abs" (RIGHT : INTEGER) return INTEGER;
  207.  
  208.    -- function "+"   (LEFT, RIGHT : INTEGER) return INTEGER;
  209.    -- function "-"   (LEFT, RIGHT : INTEGER) return INTEGER;
  210.    -- function "*"   (LEFT, RIGHT : INTEGER) return INTEGER;
  211.    -- function "/"   (LEFT, RIGHT : INTEGER) return INTEGER;
  212.    -- function "rem" (LEFT, RIGHT : INTEGER) return INTEGER;
  213.    -- function "mod" (LEFT, RIGHT : INTEGER) return INTEGER;
  214.  
  215.    -- function "**"  (LEFT : INTEGER; RIGHT : INTEGER) return INTEGER;
  216.  
  217.       -- An implementation may provide additional predefined integer types.
  218.       It is recommended that -- the names of such additional types end with
  219.       INTEGER as in SHORT_INTEGER  or  LONG_INTEGER.  -- The  specification
  220.       of   each  operator  for  the  type  universal_integer,  or  for  any
  221.       additional -- predefined  integer  type,  is  obtained  by  replacing
  222.       INTEGER  by  the  name of the type  in  the -- specification  of  the
  223.       corresponding  operator  of the type INTEGER, except for the right --
  224.       operand of the exponentiating operator.
  225.  
  226.  
  227.       -- The universal type universal_real is predefined.
  228.  
  229.    type FLOAT is IMPLEMENTATION_DEFINED;
  230.  
  231.    -- The predefined operators for this type are as follows:
  232.  
  233.    -- function "="   (LEFT, RIGHT : FLOAT) return BOOLEAN;
  234.    -- function "/="  (LEFT, RIGHT : FLOAT) return BOOLEAN;
  235.    -- function "<"   (LEFT, RIGHT : FLOAT) return BOOLEAN;
  236.    -- function "<="  (LEFT, RIGHT : FLOAT) return BOOLEAN;
  237.    -- function ">"   (LEFT, RIGHT : FLOAT) return BOOLEAN;
  238.    -- function ">="  (LEFT, RIGHT : FLOAT) return BOOLEAN;
  239.  
  240.    -- function "+"   (RIGHT : FLOAT) return FLOAT;
  241.    -- function "-"   (RIGHT : FLOAT) return FLOAT;
  242.    -- function "abs" (RIGHT : FLOAT) return FLOAT;
  243.  
  244.    -- function "+"   (LEFT, RIGHT : FLOAT) return FLOAT;
  245.    -- function "-"   (LEFT, RIGHT : FLOAT) return FLOAT;
  246.    -- function "*"   (LEFT, RIGHT : FLOAT) return FLOAT;
  247.    -- function "/"   (LEFT, RIGHT : FLOAT) return FLOAT;
  248.  
  249.    -- function "**"  (LEFT : FLOAT; RIGHT : INTEGER) return FLOAT;
  250.  
  251.       -- An  implementation  may  provide  additional  predefined  floating
  252.       point  types.   It  is --  recommended   that   the   names  of  such
  253.       additional  types  end with FLOAT as in SHORT_FLOAT or -- LONG_FLOAT.
  254.       The specification of each operator for the type  universal_real,   or
  255.       for   any -- additional  predefined  floating point type, is obtained
  256.       by replacing FLOAT by the name of -- the type in the specification of
  257.       the  corresponding  operator  of  the  type  FLOAT.
  258.  
  259.  
  260.  
  261.                                    C - 3
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.       -- In addition, the following operators are predefined for  universal
  273.       types:
  274.  
  275.    -- function "*" (LEFT : universal_integer; RIGHT : universal_real)    return universal_real;
  276.    -- function "*" (LEFT : universal_real;    RIGHT : universal_integer) return universal_real;
  277.    -- function "/" (LEFT : universal_real;    RIGHT : universal_integer) return universal_real;
  278.  
  279.    -- The type universal_fixed is predefined.  The only operators declared for this type are
  280.  
  281.    -- function "*" (LEFT : any_fixed_point_type; RIGHT : any_fixed_point_type) return universal_fixed;
  282.    -- function "/" (LEFT : any_fixed_point_type; RIGHT : any_fixed_point_type) return universal_fixed;
  283.  
  284.  
  285.       --  The  following  characters  form  the  standard  ASCII  character
  286.       set.   Character  literals -- corresponding to control characters are
  287.       not  identifiers;   they  are  indicated  in  italics  in   --   this
  288.       definition.
  289.  
  290.    type CHARACTER is
  291.  
  292.           (nul,  soh,  stx,  etx,     eot,  enq,  ack,  bel,
  293.            bs,   ht,   lf,   vt,      ff,   cr,   so,   si,
  294.            dle,  dc1,  dc2,  dc3,     dc4,  nak,  syn,  etb,
  295.            can,  em,   sub,  esc,     fs,   gs,   rs,   us,
  296.  
  297.            ' ',  '!',  '"',  '#',     '$',  '%',  '&',  ''',
  298.            '(',  ')',  '*',  '+',     ',',  '-',  '.',  '/',
  299.            '0',  '1',  '2',  '3',     '4',  '5',  '6',  '7',
  300.            '8',  '9',  ':',  ';',     '<',  '=',  '>',  '?',
  301.  
  302.            '@',  'A',  'B',  'C',     'D',  'E',  'F',  'G',
  303.            'H',  'I',  'J',  'K',     'L',  'M',  'N',  'O',
  304.            'P',  'Q',  'R',  'S',     'T',  'U',  'V',  'W',
  305.            'X',  'Y',  'Z',  '[',     '\',  ']',  '^',  '_',
  306.  
  307.            '`',  'a',  'b',  'c',     'd',  'e',  'f',  'g',
  308.            'h',  'i',  'j',  'k',     'l',  'm',  'n',  'o',
  309.            'p',  'q',  'r',  's',     't',  'u',  'v',  'w',
  310.            'x',  'y',  'z',  '{',     '|',  '}',  '',   del);
  311.  
  312.  
  313.        for CHARACTER use  --  128 ASCII character set without holes
  314.              (0, 1, 2, 3, 4, 5, ..., 125, 126, 127);
  315.  
  316.        -- The predefined operators for the type CHARACTER are the same as for any enumeration type.
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                    C - 4
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.    package ASCII is
  337.  
  338.       --  Control characters:
  339.  
  340.       NUL       : constant CHARACTER := NUL;       SOH        : constant CH